Ellis Hughes
Fred Hutch Cancer Research Center - SCHARP - VISC
rstudio::conf(2020L)
VALIDATION
https://bethgittings.tumblr.com/post/34641171446
Establishing documentation that a
is in compliance.
Record proof that it does what we expect it to do
Improves Safey And Quality


image source: https://storage.needpix.com/rsynced_images/crowd-2045498_1280.jpg



Specifications
Code
Test Cases
Test Case Code
Documentation
-- DESCRIPTION
-- man
|__hello.Rd
-- NAMESPACE
-- R
|__jokes.R
-- tests
|__testthat
|__testthat.R
-- vignettes
|__Validate.Rmd
|__Validation
|__Specifications
|__specification_001.Rmd
|__Test_Cases
|__test_case_001.R
|__Test_Case_Code
|__test_test_case_001.R
What are the requirements of the package?
Note that writing good specifications is hard
- My RStudio::Conference presentation will educate attendees
- Cover the 5 Elements of Validation
- Be 15-20 minutes long.
#' @title Specifications For RStudio Conf 2020 Success
#' @section Last updated by:
#' Ellis Hughes
#' @section Last updated date:
#' 2020/01/29
+ _Specifications_
+ 1.1 Presentation must explain validation procedure.
+ 1.2 Be entertaining by causing 3 laughter sessions.
+ 1.3 Inform and document each step necessary for success.
+ 1.4 (Optional) Fame and Glamour and start branded accessories chain.
-- vignettes
|__Validate.Rmd
|__Validation
|__Specifications
|__specification_001.Rmd
https://imgur.com/gallery/QC6Nllw
Dont worry, I won’t be telling you how to code
foo <- function(bar,baz){
print(bar)
Sys.sleep(3)
print(baz)
}
As the function author, does it behave as you expect
Protection from accidental changes
testthat
#' @title Deliver Jokes
#' @description
#' Deliver jokes with punchlines. Wait 3 seconds for the punchline.
#' @param Setup Joke setup
#' @param Punchline Joke punchline
#' @example
#' joke('To the person who stole my presentation -','I hope you do not Excel.')
#'
#' @section Last updated by:
#' Ellis Hughes
#' @section Last updated date:
#' 2020/01/29
joke <- function(Setup, Punchline){
print(Setup)
Sys.sleep(3)
print(Punchline)
}
-- R
|__jokes.R
-- man
|__hello.Rd
-- tests
|__testthat
|__testthat.R
Draw connections between specifications and functions
What Specifications are being satistified by the test passing
setup inputs steps to follow expectations of results
https://thevirtualinstructor.com/blog/wp-content/uploads/2019/01/how-step-by-step-drawing-tutorials-can-lead-you-astray.jpg
https://thegraphicsfairy.com/wp-content/uploads/blogger/-D9oAqKr5JNU/TYocayndzhI/AAAAAAAALY8/T9igMEmEnII/s1600/draw-owls-gfairysm.jpg
#' @title RStudio Conf 2020 Success Test Cases 001
#' @section Last updated by:
#' Ellis Hughes
#' @section Last update date:
#' 2020/01/29
+ _Test Cases_
+ Setup: Create RStudio::Conf 2020 Presentation
+ T 1.1 Test that specifications 1.2, 1.2, and 1.3 by practicing presentation on unsuspecting co-workers
- Present to a captive audience of coworkers and later your significant other
+ T 1.1.1 Test that the presentation was informative by asking what your audience learned.
+ T 1.1.2 Test that you were entertaining by counting the amount of chuckles (>3)
+ T 1.1.2.1 Alternatively, groans from your significant other at your jokes (>4)
-- vignettes
|__Validate.Rmd
|__Validation
|__Test_Cases
|__test_case_001.R
testthat format
Combine with Roxygen comments
context('RStudio Conf 2020 Success')
#' @title RStudio Conf 2020 Success
#' @section Last updated by:
#' Ellis Hughes
#' @section Last update date:
#' 2020/01/29
#'
testthat('T1.1',{
joke_result <- joke('What do you call a fake noodle?','An Impasta')
expect_true(is_dad_joke(joke_result))
expect_true(caused_laugher(joke_result))
expect_true(embarrased_offspring(joke_result))
})
reporter object is created

Record all elements in a single location
Scraping for Author and Edit Dates
Separating out specs into files allows for modular extension
Roxygen to document editing and edit dates
Testthat to evaluate and record test case code results